<cfsetting enablecfoutputonly="Yes">
<!---
	place.cfm
--->

<cfset place=structNew()>
<cfloop list="lat,lng,streetaddress,titlenoformatting,city,region,country,phone,street,title" index="colName">
	<cfif structKeyExists(URL, colName)>
		<cfset place[colName]=trim(URL[colName])>
	<cfelse>
		<cfset place[colName]="">
	</cfif>
</cfloop>
<cfif structKeyExists(URL, "phonenumbers[0].number")>
	<cfset place["phone"]=URL["phonenumbers[0].number"]>
</cfif>
<cfif place.titlenoformatting neq "">
	<cfset place["title"]=place["titlenoformatting"]>
	<cfset structDelete(place, "titlenoformatting")>
</cfif>
<cfif place.streetaddress neq "">
	<cfset place["street"]=place["streetaddress"]>
	<cfset structDelete(place, "streetaddress")>
</cfif>

<cfmodule template="_head.cfm" pageTitle="Place">

<cfoutput>
<style type="text/css">
html, body {
	background-color: white;
	color: black;
	font-family: Calibri, Tahoma, Verdana, Arial, 'Bitstream Vera Sans', 'Vera Sans', Helvetica, sans-serif, sans;
	padding: 0;
	margin: 0;
}
p {
	margin: 1em 0 0 0;
}
.err {
	color: maroon;
	background-color: yellow;
	padding: 1em;
	text-align: center;
}
h1 {
	font-size: 115%;
	color: ##224488;
	margin: 0 0 0.25em 0;
	padding: 0 0 0 0;
	border-bottom: 1px solid ##3366cc;
	font-weight: bold;
}
h2 {
	font-size: 100%;
	font-weight: bold;
	color: ##666666;
	margin: 0 0 0 0;
	padding: 0 0 0 0;
	border-top: 1px solid ##dddddd;
	background-color: ##f8f8f8;
	padding-left: 0.25em;
}
.tel { float: right; }
.info {
	border-top: 1px solid ##eeeeee;
	border-bottom: 1px solid ##eeeeee;
	background-color: ##f8f8f8;
	color: ##4488ff;
	padding: 0.5em;
	text-align: center;
}
.adr { margin-bottom: 0.25em; }
td {
	padding: 0.125em 0.25em;
}
.selected { color: ##333333; background-color: ##dddddd; }
.yes .selected { color: ##006600; background-color: ##ddffdd; }
.no .selected { color: ##660000; background-color: ##ffdddd; }
span.yes { color: ##006600; }
span.no { color: ##660000; }
span.unsure { color: ##999999; }
form {
	margin: 0 0 0 0;
	padding: 0 0 0 0;
}
.ratingcounts td { color: ##cccccc; }
</style>
</head>
<body>
</cfoutput>

<cftry>
	<cfif not (isNumeric(place.lat) and isNumeric(place.lng) and (len(place.title) gt 0))><cfthrow message="Your browser seems to be sending us garbage.  Please reload the page."></cfif>
	<cfoutput>
<h1 class="label">#HTMLEditFormat(place.title)#</h1>
<div class="tel">#HTMLEditFormat(place.phone)#</div>
<div class="adr">
<div class="street-address">#HTMLEditFormat(place.street)#</div>
<div class="city-state-country">
	<span class="locality">#HTMLEditFormat(place.city)#</span>, <span class="region">#HTMLEditFormat(place.region)#</span> <span class="country-name">#HTMLEditFormat(place.country)#</span>
</div>
</div>
	</cfoutput>
	<cfquery datasource="nowrists2007" name="FindPlace">
	SELECT id,
		(CONVERT(MONEY,OverallRating)) / 50.0 AS OverallRating, OverallRatingCount,
		(CONVERT(MONEY,QuietRating)) / 50.0 AS QuietRating, QuietRatingCount,
		(CONVERT(MONEY,AmenitiesRating)) / 50.0 AS AmenitiesRating, AmenitiesRatingCount,
		WifiFree, WifiPaid, FoodDrinks, FoodSolid, Outlets, OpenUntil, Days
	FROM nws_places
	WHERE (lng = <cfqueryparam cfsqltype="CF_SQL_INTEGER" value="#Int(Val(place.lng)*1000000)#">)
	  AND (lat = <cfqueryparam cfsqltype="CF_SQL_INTEGER" value="#Int(Val(place.lat)*1000000)#">)
	  AND (title = <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#Left(place.title,64)#">)
	</cfquery>
	<cfoutput>
<h2>Ratings</h2>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr align="center">
	<td width="33%">Overall</td>
	<td width="34%">Tranquility</td>
	<td width="33%">Amenities</td>
</tr>
<tr align="center">
	<td width="33%" id="overallrating" nowrap="nowrap"><cfif isNumeric(FindPlace.OverallRating)>#DecimalFormat(FindPlace.OverallRating)#<cfelse><span class="unsure">(none yet)</span></cfif></td>
	<td width="34%" id="quietrating" nowrap="nowrap"><cfif isNumeric(FindPlace.QuietRating)>#DecimalFormat(FindPlace.QuietRating)#<cfelse><span class="unsure">(none yet)</span></cfif></td>
	<td width="33%" id="amentitiesrating" nowrap="nowrap"><cfif isNumeric(FindPlace.AmenitiesRating)>#DecimalFormat(FindPlace.AmenitiesRating)#<cfelse><span class="unsure">(none yet)</span></cfif></td>
</tr>
<tr align="center" class="ratingcounts">
	<td width="33%" id="overallratingcount" nowrap="nowrap"><cfif isNumeric(FindPlace.OverallRatingCount)>#NumberFormat(FindPlace.OverallRatingCount)#<cfelse>0</cfif> vote<cfif FindPlace.OverallRatingCount neq "1">s</cfif></td>
	<td width="34%" id="quietratingcount" nowrap="nowrap"><cfif isNumeric(FindPlace.QuietRatingCount)>#NumberFormat(FindPlace.QuietRatingCount)#<cfelse>0</cfif> vote<cfif FindPlace.QuietRatingCount neq "1">s</cfif></td>
	<td width="33%" id="amentitiesratingcount" nowrap="nowrap"><cfif isNumeric(FindPlace.AmenitiesRatingCount)>#NumberFormat(FindPlace.AmenitiesRatingCount)#<cfelse>0</cfif> vote<cfif FindPlace.AmenitiesRatingCount neq "1">s</cfif></td>
</tr>
</table>
<h2>Amenities</h2>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
	<td nowrap="nowrap" width="1%">Beverages:</td>
	<td width="49%"><cfif FindPlace.FoodDrinks eq "1"><span class="yes">Yes</span><cfelseif FindPlace.FoodDrinks eq "0"><span class="no">No</span><cfelse><span class="unsure">Not Sure</span></cfif></td>
	<td nowrap="nowrap" width="1%">Power Outlets:</td>
	<td width="49%"><cfif FindPlace.Outlets eq "1"><span class="yes">Yes</span><cfelseif FindPlace.Outlets eq "0"><span class="no">No</span><cfelse><span class="unsure">Not Sure</span></cfif></td>
</tr>
<tr>
	<td nowrap="nowrap" width="1%">Solid Food:</td>
	<td width="49%"><cfif FindPlace.FoodSolid eq "1"><span class="yes">Yes</span><cfelseif FindPlace.FoodSolid eq "0"><span class="no">No</span><cfelse><span class="unsure">Not Sure</span></cfif></td>
	<td nowrap="nowrap" width="1%">Free WiFi:</td>
	<td width="49%"><cfif FindPlace.WifiFree eq "1"><span class="yes">Yes</span><cfelseif FindPlace.WifiFree eq "0"><span class="no">No</span><cfelse><span class="unsure">Not Sure</span></cfif></td>
</tr>
<tr>
	<td width="1%">&nbsp;</td>
	<td width="49%">&nbsp;</td>
	<td nowrap="nowrap" width="1%">Paid WiFi:</td>
	<td width="49%"><cfif FindPlace.WiFiPaid eq "1"><span class="yes">Yes</span><cfelseif FindPlace.WiFiPaid eq "0"><span class="no">No</span><cfelse><span class="unsure">Not Sure</span></cfif></td>
</tr>
</table>
<p align="center"><a href="tell.cfm?<cfloop collection="#place#" item="colName">&amp;#urlEncodedFormat(lCase(colName))#=#urlEncodedFormat(place[colName])#</cfloop>" target="_self">Would you like to update this information?</a></p>
	</cfoutput>
<cfcatch>
	<cfoutput><p class="err">#CFCatch.Message#</p></cfoutput>
</cfcatch>
</cftry>

<cfmodule template="_foot.cfm">

<cfsetting enablecfoutputonly="No">